#include "World.h"
#include <exception>
#include <iostream>

namespace steam
{
	namespace firebox
	{

		World::World()
		{
		}

		World::~World()
		{
			for (Updaters::iterator it = m_updaters.begin(), itE = m_updaters.end(); it != itE; it++)
			{
				delete (*it);
			}

			for (Entities::iterator it = m_entities.begin(), itE = m_entities.end(); it != itE; it++)
			{
				delete (*it);
			}
		}

		void World::update(float elapsedTime)
		{
			for (Updaters::iterator it = m_updaters.begin(), itE = m_updaters.end(); it != itE; it++)
			{
				(*it)->update(elapsedTime);
			}
		}

		void World::addUpdater( base::IUpdater* updater )
		{
			m_updaters.push_back(updater);
		}

		void World::removeUpdater( base::IUpdater* updater )
		{
			std::exception("World::removeUpdater : Function Not Implemented");
		}

		void World::addEntity( firebox::Entity* entity )
		{
			m_entities.push_back(entity);
		}

		const World::Entities& World::getEntities() const
		{
			return m_entities;
		}

		base::EntityFactory World::getFactory() const
		{
			return m_factory;
		}

	}
}